package com.kaizzi.data.jdl.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kaizzi.data.common.been.TempBeen;
import com.kaizzi.data.jdl.entity.TaskLogs;
import com.kaizzi.data.jdl.mapper.TaskLogsMapper;
import com.kaizzi.data.jdl.service.JdlNumService;
import com.kaizzi.data.jdl.service.TaskLogsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Kzen
 * @Description description
 * @date 2020/9/11
 */
@Service
@Slf4j
public class TaskLogsServiceImpl extends ServiceImpl<TaskLogsMapper, TaskLogs> implements TaskLogsService {

    @Resource
    private TaskLogsMapper taskLogsMapper;
    @Resource
    private JdlNumService jdlNumService;

    @Override
    @DS("jdl_view")
    public long getExpendPoints(String startDate, String endDate) {
        Long expendPoints = taskLogsMapper.getExpendPoints(startDate, endDate);
        return jdlNumService.transNum(expendPoints);
    }

    @Override
    @DS("jdl_view")
    public long getPoints(String startDate, String endDate) {
        Long points = taskLogsMapper.getPoints(startDate, endDate);
        return jdlNumService.transNum(points);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getPerformance(String startDate, String endDate) {
        return taskLogsMapper.getPerformance(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public long getUtcRushBuy(String startDate, String endDate) {
        Long utcRushBuy = taskLogsMapper.getUtcRushBuy(startDate, endDate);
        return jdlNumService.transNum(utcRushBuy);
    }

    @Override
    @DS("jdl_view")
    public long getSynchronize1(String startDate, String endDate) {
        Long synchronize1 = taskLogsMapper.getSynchronize1(startDate, endDate);
        return jdlNumService.transNum(synchronize1);
    }

    @Override
    @DS("jdl_view")
    public long getSynchronize2(String startDate, String endDate) {
        Long synchronize2 = taskLogsMapper.getSynchronize2(startDate, endDate);
        return jdlNumService.transNum(synchronize2);
    }

    @Override
    @DS("jdl_view")
    public long getSynchronize3(String startDate, String endDate) {
        Long synchronize3 = taskLogsMapper.getSynchronize3(startDate, endDate);
        return jdlNumService.transNum(synchronize3);
    }

    @Override
    @DS("jdl_view")
    public long getSynchronize4(String startDate, String endDate) {
        Long synchronize4 = taskLogsMapper.getSynchronize4(startDate, endDate);
        return jdlNumService.transNum(synchronize4);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getGClubPoint(String startDate, String endDate) {
        return taskLogsMapper.getGClubPoint(startDate,endDate);
    }
}
